using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class Admin_CreateUser : System.Web.UI.Page
{
    /// <summary>
    /// 
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void Page_Load(object sender, EventArgs e)
    {

    }

    /// <summary>
    /// 
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void CreateUserWizard1_CreatedUser(object sender, EventArgs e)
    {

    }

    /// <summary>
    /// 
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void AssignUserToRoles_OnActivate(object sender, EventArgs e)
    {
        this.AvailableRoles.DataSource = Roles.GetAllRoles();
        this.AvailableRoles.DataBind();
    }


    /// <summary>
    /// 
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void AssignUserToRoles_OnDeactivate(object sender, EventArgs e)
    {
        for (int i = 0; i < this.AvailableRoles.Items.Count; i++)
        {
            if (this.AvailableRoles.Items[i].Selected == true)
            {
                Roles.AddUserToRole(this.CreateUserWizard1.UserName, this.AvailableRoles.Items[i].Value); 
            }
        }
    }
}
